use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::fs::OpenOptions;
use std::ops::Not;

fn main() {
    let args: Vec<String> = env::args().collect();
    println!("{},{}", args[1],args[2]);
    let f = File::open(&args[1]).unwrap();
    let mut wf = OpenOptions::new().create(true).append(true).open(&args[2]).unwrap();
	let bytes = std::fs::read(&args[1]).unwrap();
	let mut vec_empty: Vec<u8> = Vec::new();
	let mut temp:[u8;2] = [0x41,0x32];
	let mut i:i32=1;
	for bt in bytes.iter()
	{
	//	println!("{:X}",bt);
		//yyplet tc =!bt as char;
		let tc =bt.not();
	//	println!("{:x}",tc);
		if i==1 {
			temp[0]=tc;
		}
		else
		{
			temp[1]=tc;
		}
		if i%2==0 {
			i=1;
	//		println!("{:x}",temp[1]);
			wf.write(&temp).unwrap();
		}
		else
		{
		i+=1;
		}	
		//vec_empty.push(tc);
	}
	//let string2: String = String::from_utf8(vec_empty).unwrap();
	//wf.write(string2.as_bytes()).unwrap();
}
